package enemies 
{
	/**
	 * ...
	 * @author Excel Excel
	 */
	import flash.display.*;
	import flash.geom.ColorTransform;
	import flash.events.*;
	import guns.*
	
	public class Turret extends Follower
	{
		public var gun:Gun;
		public function Turret(stage: Stage, t: Player) 
		{
			super(stage, t, 0.0); //r=10
			gun = new Pistol(this);
		//	trace("turret's ready!");
		}
		override protected function Draw():void
		{
			graphics.clear();
			graphics.beginFill(0x00FF00);
			graphics.drawCircle(0, 0, r);
			graphics.beginFill(0x99FF99);
			graphics.drawCircle(0, 0, r/2);
			graphics.drawRect(-r/5, -r/5, r, 2*r/5);
			graphics.endFill();
			ColorMeIfImDead();
		}
		
		override public function movePlayer(event:Event):void
		{
			super.movePlayer(event);
			if (brainDead) 
			{
				gun.triggerHappy = false;
				dx = 0;
				dy = 0;
				ColorMePosessed();
				MaskCollide = MaskCollide & ~GroupPlayer;
				MaskPublic = GroupJunk;
				return;
			}
			gun.triggerHappy = IsAlive() && !brainDead;
			gun.think(null);
		}
		
		override public function OnDie():void
		{
			gun.triggerHappy = false;
			super.OnDie();
		}
		override public function moveForward():void
		{}
	}

}